<template>
	<div class="goods">
		<img
			:src="data.itemImg | image_ali"
			@click.stop="openWindow(data, 'taobao')"
			class="goods-img cursor"
			alt
		/>

		<div class="goods-content">
			<div class="goods-content-title cursor" @click.stop="openWindow(data)">
				{{ data.itemTitle }}
			</div>
			<div class="goods-content-title  cursor" style="font-size:12px" @click.stop="toShop">
				{{ data.sellerShopTitle }}
			</div>
		</div>
	</div>
</template>

<script>
export default {
	props: ['data', 'params'],
	methods: {
		openWindow(data, type = 'else') {
			if (type == 'taobao') {
				window.open(data.itemLink, '_blank');
				return;
			}
			this.$emit('showdetail', {
				product: data.itemTitle,
				itemId: data.itemId,
				itemLink: data.itemLink
			});
		},
		toShop() {
			this.$router.push({
				path: '/order/shop',
				query: {
					sellerShopTitle: this.data.sellerShopTitle,
					startTime: this.params.startTime,
					endTime: this.params.endTime
				}
			});
		}
	}
};
</script>

<style lang="stylus" scoped>
.goods {
	display: flex;
	align-items: center;
	padding: 5px 10px;

	.goods-img {
		width: 63px;
		height: 63px;
		border: solid 5px #fff;
		border-radius: 8px;
	}

	.goods-content {
		display: flex;
		height 63px
		flex-direction: column;
		justify-content space-between
		margin-left: 15px;
		text-align: left;
		width: calc(100% - 90px);

		.goods-content-title {
			width: 100%;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
			color #000000
			font-size 14px
			font-weight:400;
			transition .3s
			&:hover {
				color $main-color
			}
		}

		.goods-content-orther {
			span {
				margin-left: 10px;
			}
		}
	}
}
</style>
